module NPC(
        input [31:0] pc4,
        input [31:0] pc,
        input [31:0] rs,
        input [15:0] immediate_16,
        input [25:0] immediate_26,
        input jump,
        input jr,
        input branch,
        output [31:0] npc_result
    );

    assign npc_result=(jump==1'b1&&jr==1'b1)?rs:
           (jump==1'b1&&jr==1'b0)?{pc[31:28],immediate_26,{2{1'b0}}}:
           (branch==1'b1)?{{14{immediate_16[15]}},immediate_16,{2{1'b0}}}+pc4:
           pc4;
endmodule
